﻿using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;

namespace SlideShowDFG2
{
    public class Album : INotifyPropertyChanged
    {
        public Album()
        {
            _slides = new ObservableCollection<Slide>();
        }

        private string _title;
        private string _description;
        private string _source;
        private ObservableCollection<Slide> _slides;

        public event PropertyChangedEventHandler PropertyChanged;

        public string Title
        {
            get
            {
                if (string.IsNullOrEmpty(_title)) return string.Empty;
                else return _title;
            }
            set
            {
                _title = value;
                OnPropertyChanged("Title");
            }
        }

        public string Description
        {
            get
            {
                if (string.IsNullOrEmpty(_description)) return string.Empty;
                else return _description;
            }
            set
            {
                _description = value;
                OnPropertyChanged("Description");
            }
        }

        public string Source
        {
            get
            {
                if (string.IsNullOrEmpty(_source)) return string.Empty;
                else return _source;
            }
            set
            {
                _source = value;
                OnPropertyChanged("Source");
            }
        }

        public ObservableCollection<Slide> Slides
        {
            get { return _slides; }
            set
            {
                _slides = value;
                OnPropertyChanged("Slides");
            }
        }

        protected void OnPropertyChanged(string name)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(name));
        }

        public override string ToString()
        {
            return string.Format("{0} | {1}", _title, _source);
        }
    }
}
